import { GET_LIST_DATA, LEFT_CLICK, ADD_SELECT_ITEM, MINUS_SELECT_ITEM, SHOW_CHOOSE_CONTENT, CLEAR_CAR } from './actionTypes'
import axios from "axios"
export const getListData = () => async (dispatch) => {
    let res = await axios({
        url: '/json/food.json',
        method: 'GET'
    })
    dispatch({
        type: GET_LIST_DATA,
        obj: res.data
    })
}
export const itemClick = (obj) => (dispatch) => {
    dispatch({
        type: LEFT_CLICK,
        obj: obj
    })
}
export const addSelectItem = (obj) => (dispatch) => {
    dispatch({
        obj: obj,
        type: ADD_SELECT_ITEM
    })
}
export const minusSelectItem = (obj) => (dispatch) => {
    dispatch({
        obj: obj,
        type: MINUS_SELECT_ITEM
    })
}
export const showChoose = (obj) => (dispatch) => {
    dispatch({
        type: SHOW_CHOOSE_CONTENT,
        obj: obj
    })
}
export const clearCar = (obj) => (dispatch) => {
    dispatch({
        type: CLEAR_CAR,
        obj
    })
}